<template>
    <el-tab-pane label="容器配置" name="container_configuration">
        <el-card class="box-card" shadow="hover">
            <template #header>
              <div class="card-header">
                <span>运行时配置</span>
                <el-button type="primary" @click="save_runtime_type_conf(save_runtime_type_conf_form)"
                  size="mini">保存</el-button>
              </div>
            </template>
            <el-form ref="form" :model="save_runtime_type_conf_form" size="mini" label-width="80px">
              <el-form-item label="类型">
                <SysCodeInputTs ref="SysCodeInputTsRef"></SysCodeInputTs>
              </el-form-item>
            </el-form>
          </el-card>
</el-tab-pane>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import * as Request from "@/general/request";
import { ElMessage } from 'element-plus';
import SysCodeInputTs from "@/components/communal/sys_code_input_ts.vue";

const save_runtime_type_conf_form = ref("");
let server_pod_form = ref([]);
const tableH = document.documentElement.clientHeight - 320


// 调用Pod组件传参
const SysCodeInputTsRef = ref<InstanceType<typeof SysCodeInputTs>>()
const TabtClickPod = () => {
    SysCodeInputTsRef.value?.sys_code_get("test")
}

const get_save_runtime_type_conf = async (kubernetes_cluster_id: string) => {
    const response = await Request.GET("/background/home/kubernetes/pod", {
        kubernetes_cluster_id: kubernetes_cluster_id,
    });
    if (response && response.data) {
        let return_data = response.data;
        if (return_data.success) {
            server_pod_form.value = return_data.data;
            ElMessage.success(return_data.msg);
        } else {
            ElMessage.error(return_data.msg);
        }
    }
};


const save_runtime_type_conf = (e: any) => {
      console.log(e);
    };

//  将方法暴露
defineExpose({
    get_save_runtime_type_conf
})

</script>


<style scoped>
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  width: 100%;
}
</style>